<?php

class Test {

    private function foo() {
        echo 'foo';
    }

    public function hello($name) {
        echo 'hello ' . $name;
    }

    public function ccc() {
        echo 'ccc';
    }

    public function _before_ccc() {
        echo '_before_ccc';
    }

}

$reflectionMethod = new ReflectionMethod('Test', 'hello11');
print_r($reflectionMethod);

/*
$reflectionMethod = new ReflectionMethod('Test', 'hello');
echo $reflectionMethod->invoke(new Test(), 'Mike');

$module = new Test();
$action = 'ccc';
$method = new ReflectionMethod($module, $action);
print_r($method);
var_dump($method->isPublic());
var_dump($method->isPrivate());
if ($method->isPublic()) {
    echo 'isPublic';
    $class = new ReflectionClass($module);
    // 前置操作
    print_r($class);
    if ($class->hasMethod('_before_' . $action)) {
        echo '_before_';
        $before = $class->getMethod('_before_' . $action);
        print_r($before);
        var_dump($before);
        if ($before->isPublic()) {
            $before->invoke($module);
        }
    }
}
echo 'end.';
*/